import Vue from "vue"
import Vuex from "vuex"
import auth from "./auth"
import lang from "./lang"

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    route: {}, // 用于存储路由信息
    // isZh: localStorage.getItem("lang") === "zh-CN" ? localStorage.getItem("lang") === "zh-CN" : true, // 语言状态
  },
  mutations: {
    SET_ROUTE(state, route) {
      state.route = route
    },
    SET_IS_ZH(state, isZh) {
      state.isZh = isZh
    },
  },
  actions: {
    setRoute({ commit }, route) {
      commit("SET_ROUTE", route)
    },
  },
  getters: {
    // isZh: (state) => {
    //   console.log('state.isZh :>> ', state.isZh);
    //   return state.isZh
    // },
  },
  modules: {
    auth,
    lang
  },
})
